<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<jsp:include page="style.jsp"></jsp:include>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%
	String basePath = request.getContextPath();
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户信息维护</title>

<body style="margin: 0; padding: 1px">
	<table id="userGrid"></table>
	<div id="toolbar">
		<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-add" plain="true"
			onclick="newUser()">新增用户</a> <a href="javascript:void(0);"
			class="easyui-linkbutton" iconCls="icon-edit" plain="true"
			onclick="editUser()">编辑用户信息</a> <a href="javascript:void(0);"
			class="easyui-linkbutton" iconCls="icon-remove" plain="true"
			onclick="destroyUser()">删除用户</a>
	</div>



	<div id="addDlg" class="easyui-dialog"
		style="width: 400px; height: 280px; padding: 10px 20px" closed="true"
		buttons="#dlg-buttons">
		<form id="fm" method="post">
			<div class="fitem">
				<label>姓名:</label> <input name="firstname"class="easyui-textbox" required="true">
			</div>
			<div class="fitem">
				<label>密码:</label> <input name="lastname"class="easyui-textbox" required="true">
			</div>
			<div class="fitem"><label>电话:</label> <input name="phone" class="easyui-textbox" required="true"></div>
			<div class="fitem"><label>邮箱:</label> <input name="email" class="easyui-textbox"></div>
		</form>
	</div>
	<div id="dlg-buttons">
		<a href="#" class="easyui-linkbutton" iconCls="icon-ok"
			onclick="saveUser()">新增</a> <a href="#" class="easyui-linkbutton"
			iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">取消</a>
	</div>
</body>
<script type="text/javascript">
	$(document).ready(function() {
		$('#userGrid').datagrid({
			url : '<%=basePath%>/mgrsystem/userList.do',
			columns : [ [ {
				field : 'id',
				title : '序号',
				checkbox:true
			},{
				field : 'name',
				title : '姓名'
			}, {
				field : 'alias',
				title : '昵称'
			}, {
				field : 'sex',
				title : '性别',
				formatter:function(value,row,index){
					if(value==0){
						return "男";
					}else{
						return "女";
					}
				}
			}, {
				field : 'birthday',
				title : '生日'
			}, {
				field : 'qq',
				title : 'QQ号码'
			}, {
				field : 'mobile',
				title : '手机'
			}, {
				field : 'email',
				title : '邮箱'
			}, {
				field : 'photo',
				title : '图片'
			}, {
				field : 'addr',
				title : '地址'
			}, {
				field : 'areaId',
				title : '地区'
			}, {
				field : 'password',
				title : '密码'
			}, {
				field : 'createDate',
				title : '创建日期'
			}, {
				field : 'modifyDate',
				title : '更新日期'
			}, {
				field : 'status',
				title : '状态',
				formatter:function(value,row,index){
					if(value==0){
						return "无效";
					}else{
						return "有效";
					}
				}
			}, {
				field : 'roleId',
				title : '角色',
				formatter:function(value,row,index){
					if(value==1){
						return "系统管理员";
					}else if(value==2){
						return "创始人";
					}else if(value==3){
						return "风控";
					}
				}
			}] ],
			fitColumns:true,
			striped:true,
			nowrap:true,
			loadMsg:"正在加载数据...",
			pagination:true,
			singleSelect:true,
			checkOnSelect:true
		});
		$("#userGrid").datagrid({
			toolbar: '#toolbar'
		});
	});
	
    <!--新增用户-->
	function newUser() {
		$('#addDlg').dialog('open').dialog('setTitle', '新增用户');
		$('#fm').form('clear');
	}
	<!--编辑用户信息-->
	function destroyUser() {
		//var row = $('#addDlg').datagrid('getSelected');
		alert();
		
	}
</script>
</html>